<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Attractive Alert - 优雅的JavaScript弹窗库</title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        html, body {
            height: 100%;
        }
        
        body {
            font-family: 'Inter', sans-serif;
            line-height: 1.6;
            color: #2c3e50;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            position: relative;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
            flex: 1;
            overflow-y: auto;
        }
        
        /* 主页特定样式 */
        #index-page .container {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        
        #index-page .main-content {
            flex: 1;
        }
        
        /* 文档页特定样式 */
        #docs-page .container {
            padding-bottom: 60px; /* 为版权信息留出空间 */
        }
        
        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 0;
            margin-bottom: 10px;
        }
        
        .logo {
            font-size: 24px;
            font-weight: 700;
            color: #2c3e50;
            display: flex;
            align-items: center;
        }
        
        .logo-icon {
            margin-right: 10px;
            font-size: 28px;
            color: #3498db;
        }
        
        nav ul {
            display: flex;
            list-style: none;
        }
        
        nav ul li {
            margin-left: 30px;
        }
        
        nav ul li a {
            text-decoration: none;
            color: #2c3e50;
            font-weight: 500;
            font-size: 16px;
            transition: color 0.3s;
            position: relative;
        }
        
        nav ul li a:hover {
            color: #3498db;
        }
        
        nav ul li a::after {
            content: '';
            position: absolute;
            width: 0;
            height: 2px;
            bottom: -5px;
            left: 0;
            background-color: #3498db;
            transition: width 0.3s;
        }
        
        nav ul li a:hover::after {
            width: 100%;
        }
        
        .hero {
            text-align: center;
            padding: 60px 0;
            margin-bottom: 40px;
        }
        
        .hero h1 {
            font-size: 2.8rem;
            color: #2c3e50;
            margin-bottom: 30px;
            letter-spacing: 0.5px;
        }
        
        .typewriter {
            font-size: 1.5rem;
            color: #3498db;
            margin-bottom: 40px;
            min-height: 60px;
            font-weight: 400;
        }
        
        .buttons {
            display: flex;
            justify-content: center;
            gap: 20px;
            margin-top: 30px;
        }
        
        .btn {
            display: inline-block;
            padding: 12px 28px;
            border-radius: 6px;
            text-decoration: none;
            font-weight: 500;
            font-size: 16px;
            transition: all 0.3s;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }
        
        .btn-primary {
            background: linear-gradient(135deg, #3498db 0%, #2c3e50 100%);
            color: white;
        }
        
        .btn-secondary {
            background: white;
            color: #3498db;
            border: 2px solid #3498db;
        }
        
        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
        }
        
        /* 版权信息样式 */
        footer {
            text-align: center;
            color: #7f8c8d;
            padding: 10px 0;
            width: 100%;
        }
        
        /* 主页footer样式 - 相对定位 */
        #index-page footer {
            position: relative;
            margin-top: auto;
        }
        
        /* 文档页footer样式 - 在文档流中 */
        #docs-page footer {
            position: relative;
            margin-top: 40px;
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            .hero h1 {
                font-size: 2.2rem;
            }
            
            .typewriter {
                font-size: 1.2rem;
            }
            
            nav ul {
                display: none;
            }
            
            .buttons {
                flex-direction: column;
                align-items: center;
            }
        }
        
        /* 文档页样式 */
        .docs-container {
            max-width: 900px;
        }
        
        .docs-section {
            padding: 30px;
            margin-bottom: 20px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        }
        
        .docs-section h2 {
            color: #2c3e50;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid #3498db;
        }
        
        .docs-section p {
            margin-bottom: 20px;
            line-height: 1.8;
            color: #555;
        }
        
        .code-block {
            background: #2c3e50;
            color: #ecf0f1;
            padding: 20px;
            border-radius: 8px;
            margin: 20px 0;
            overflow-x: auto;
            font-family: monospace;
            font-size: 15px;
            line-height: 1.5;
            white-space: nowrap;
        }
        
        .test-btn {
            background: #3498db;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 15px;
            margin-top: 15px;
            transition: background 0.3s;
            font-family: 'Inter', sans-serif;
        }
        
        .test-btn:hover {
            background: #2980b9;
        }
        
        /* 下载模态框 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        
        .modal-content {
            background: white;
            padding: 30px;
            border-radius: 12px;
            max-width: 500px;
            width: 100%;
            box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
        }
        
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        
        .close-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #7f8c8d;
        }
        
        .download-options {
            margin-top: 20px;
        }
        
        .download-options a {
            display: block;
            margin: 10px 0;
            color: #3498db;
            text-decoration: none;
            padding: 10px;
            border-radius: 6px;
            background: #f8f9fa;
            transition: background 0.3s;
        }
        
        .download-options a:hover {
            background: #e9ecef;
            text-decoration: none;
        }
        
        /* 代码高亮 */
        .code-keyword {
            color: #ff79c6;
        }
        
        .code-string {
            color: #f1fa8c;
        }
        
        .code-comment {
            color: #6272a4;
        }
        
        .code-function {
            color: #50fa7b;
        }
        
        .code-parameter {
            color: #ffb86c;
        }
    </style>
</head>
<body>
    <!-- 首页内容 -->
    <div id="index-page">
        <div class="container">
            <div class="main-content">
                <header>
                    <div class="logo">
                        <span class="logo-icon">⚡</span>
                        <span>Attractive Alert</span>
                    </div>
                    <nav>
                        <ul>
                            <li><a href="#index-page">首页</a></li>
                            <li><a href="#docs-page" onclick="showPage('docs-page')">文档</a></li>
                            <li><a href="#" onclick="showDownloadModal()">下载</a></li>
                            <li><a href="https://gitee.com/wxy6987/attractive-alert-library" target="_blank">Gitee</a></li>
                        </ul>
                    </nav>
                </header>

                <section class="hero">
                    <h1>美观的弹窗库</h1>
                    <div class="typewriter" id="typewriter"></div>
                    <div class="buttons">
                        <a href="#" class="btn btn-primary" onclick="showDownloadModal()">立即下载</a>
                        <a href="#docs-page" class="btn btn-secondary" onclick="showPage('docs-page')">使用说明</a>
                    </div>
                </section>
            </div>
            
            <footer>
                <p>©2025 王小玗 | Apache 2.0</p>
            </footer>
        </div>
    </div>

    <!-- 文档页内容 -->
    <div id="docs-page" style="display: none;">
        <div class="container">
            <header>
                <div class="logo">
                    <span class="logo-icon">⚡</span>
                    <span>Attractive Alert 文档</span>
                </div>
                <nav>
                    <ul>
                        <li><a href="#index-page" onclick="showPage('index-page')">首页</a></li>
                        <li><a href="#docs-page" onclick="showPage('docs-page')">文档</a></li>
                        <li><a href="#" onclick="showDownloadModal()">下载</a></li>
                        <li><a href="https://gitee.com/wxy6987/attractive-alert-library" target="_blank">Gitee</a></li>
                    </ul>
                </nav>
            </header>

            <div class="docs-container">
                <div class="docs-section">
                    <h2>安装与引入</h2>
                    <p>通过以下方式下载并引入Attractive Alert：</p>
                    <div class="code-block">
<span class="code-comment">// 引入ATAL库</span><br>
&lt;script src="atal.js"&gt;&lt;/script&gt;<br>
                    </div>
                    <button class="test-btn" onclick="testInstallation()">测试安装</button>
                </div>

                <div class="docs-section">
                    <h2>基本用法</h2>
                    <p>创建一个简单的提示弹窗：</p>
                    <div class="code-block">
<span class="code-comment">// 创建一个简单的提示弹窗</span><br>
Atal.alert(<span class="code-string">"这是一个提示信息"</span>);<br>
<br>
<span class="code-comment">// 创建一个带标题的确认弹窗</span><br>
Atal.alert({<br>
&nbsp;&nbsp;title: <span class="code-string">"确认操作"</span>,<br>
&nbsp;&nbsp;content: <span class="code-string">"您确定要执行此操作吗？"</span>,<br>
&nbsp;&nbsp;icon: <span class="code-string">"question"</span>,<br>
&nbsp;&nbsp;buttons: {<br>
&nbsp;&nbsp;&nbsp;&nbsp;confirm: <span class="code-keyword">true</span>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;cancel: <span class="code-keyword">true</span><br>
&nbsp;&nbsp;}<br>
}).ok(() => {<br>
&nbsp;&nbsp;<span class="code-comment">// 用户点击了确认</span><br>
&nbsp;&nbsp;console.<span class="code-function">log</span>(<span class="code-string">"确认操作"</span>);<br>
}).cancel(() => {<br>
&nbsp;&nbsp;<span class="code-comment">// 用户点击了取消</span><br>
&nbsp;&nbsp;console.<span class="code-function">log</span>(<span class="code-string">"取消操作"</span>);<br>
});
                    </div>
                    <button class="test-btn" onclick="testBasicUsage()">测试基本用法</button>
                </div>

                <div class="docs-section">
                    <h2>高级配置</h2>
                    <p>Attractive Alert允许自定义弹窗的各个方面：</p>
                    <div class="code-block">
<span class="code-comment">// 创建自定义弹窗</span><br>
Atal.alert({<br>
&nbsp;&nbsp;title: <span class="code-string">"自定义弹窗"</span>,<br>
&nbsp;&nbsp;content: <span class="code-string">"这是一个自定义弹窗"</span>,<br>
&nbsp;&nbsp;type: <span class="code-string">"success"</span>, <span class="code-comment">// success, error, warning, info</span><br>
&nbsp;&nbsp;buttons: {<br>
&nbsp;&nbsp;&nbsp;&nbsp;confirm: {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text: <span class="code-string">"确定"</span>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color: <span class="code-string">"#3498db"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;},<br>
&nbsp;&nbsp;&nbsp;&nbsp;cancel: {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text: <span class="code-string">"取消"</span>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color: <span class="code-string">"#e74c3c"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;},<br>
&nbsp;&nbsp;animateIcon: <span class="code-keyword">true</span>,<br>
&nbsp;&nbsp;timer: <span class="code-parameter">5000</span> <span class="code-comment">// 5秒后自动关闭</span><br>
});
                    </div>
                    <button class="test-btn" onclick="testAdvancedConfig()">测试高级配置</button>
                </div>

                <div class="docs-section">
                    <h2>主题定制</h2>
                    <p>Attractive Alert支持多种主题和自定义样式：</p>
                    <div class="code-block">
<span class="code-comment">// 设置全局默认配置</span><br>
Atal.setDefaults({<br>
&nbsp;&nbsp;title: <span class="code-string">"提示"</span>,<br>
&nbsp;&nbsp;buttons: {<br>
&nbsp;&nbsp;&nbsp;&nbsp;confirm: <span class="code-string">"确定"</span>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;cancel: <span class="code-string">"取消"</span><br>
&nbsp;&nbsp;},<br>
&nbsp;&nbsp;animateIcon: <span class="code-keyword">true</span><br>
});<br>
<br>
<span class="code-comment">// 创建预设配置实例</span><br>
<span class="code-keyword">const</span> myAtal = Atal.at({<br>
&nbsp;&nbsp;icon: <span class="code-string">"info"</span>,<br>
&nbsp;&nbsp;buttons: {<br>
&nbsp;&nbsp;&nbsp;&nbsp;confirm: <span class="code-string">"好的"</span>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;cancel: <span class="code-keyword">false</span><br>
&nbsp;&nbsp;}<br>
});<br>
<br>
<span class="code-comment">// 使用预设配置</span><br>
myAtal(<span class="code-string">"预设配置"</span>, <span class="code-string">"这是一个使用预设配置的弹窗"</span>);
                    </div>
                    <button class="test-btn" onclick="testTheming()">测试主题</button>
                </div>

                <div class="docs-section">
                    <h2>图标类型</h2>
                    <p>Attractive Alert提供多种内置图标：</p>
                    <div class="code-block">
<span class="code-comment">// 使用不同的图标类型</span><br>
Atal.alert({title: <span class="code-string">"成功"</span>, content: <span class="code-string">"操作成功完成"</span>, icon: <span class="code-string">"success"</span>});<br>
Atal.alert({title: <span class="code-string">"错误"</span>, content: <span class="code-string">"发生了一个错误"</span>, icon: <span class="code-string">"error"</span>});<br>
Atal.alert({title: <span class="code-string">"警告"</span>, content: <span class="code-string">"这是一个警告"</span>, icon: <span class="code-string">"warning"</span>});<br>
Atal.alert({title: <span class="code-string">"信息"</span>, content: <span class="code-string">"这是一条信息"</span>, icon: <span class="code-string">"info"</span>});<br>
Atal.alert({title: <span class="code-string">"问题"</span>, content: <span class="code-string">"您确定吗？"</span>, icon: <span class="code-string">"question"</span>});<br>
Atal.alert({title: <span class="code-string">"心形"</span>, content: <span class="code-string">"您喜欢吗？"</span>, icon: <span class="code-string">"heart"</span>});<br>
Atal.alert({title: <span class="code-string">"星星"</span>, content: <span class="code-string">"给个五星好评！"</span>, icon: <span class="code-string">"star"</span>});
                    </div>
                    <button class="test-btn" onclick="testIcons()">测试图标</button>
                </div>
            </div>
            
            <footer>
                <p>©2025 王小玗 | Apache 2.0</p>
            </footer>
        </div>
    </div>

    <!-- 下载模态框 -->
    <div id="download-modal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2>下载Attractive Alert</h2>
                <button class="close-btn" onclick="closeDownloadModal()">&times;</button>
            </div>
            <p>请选择以下一种方式下载Attractive Alert：</p>
            <div class="download-options">
                <a href="atal.js" download="atal.js">直接下载 (JS)</a>
                <a href="javascript:void 0">Git克隆地址:<wbr />https://gitee.com<wbr />/wxy6987<wbr />/attractive-alert-library.git</a>
                <a href="https://gitee.com/wxy6987/attractive-alert-library">访问Gitee仓库</a>
            </div>
        </div>
    </div>

    <!-- 引入Atal库 -->
    <script src="atal.js"></script>

    <script>
        // 打字机效果
        const typewriterText = "极简精美的JavaScript弹窗库";
        let i = 0;
        function typeWriter() {
            if (i < typewriterText.length) {
                document.getElementById("typewriter").innerHTML += typewriterText.charAt(i);
                i++;
                setTimeout(typeWriter, 100);
            }
        }
        
        // 页面加载完成后启动打字机效果
        window.onload = function() {
            typeWriter();
        };
        
        // 显示指定页面
        function showPage(pageId) {
            document.getElementById('index-page').style.display = pageId === 'index-page' ? 'block' : 'none';
            document.getElementById('docs-page').style.display = pageId === 'docs-page' ? 'block' : 'none';
            
            // 滚动到顶部
            window.scrollTo(0, 0);
        }
        
        // 显示下载模态框
        function showDownloadModal() {
            document.getElementById('download-modal').style.display = 'flex';
        }
        
        // 关闭下载模态框
        function closeDownloadModal() {
            document.getElementById('download-modal').style.display = 'none';
        }
        
        // 点击模态框外部关闭
        window.onclick = function(event) {
            const modal = document.getElementById('download-modal');
            if (event.target === modal) {
                closeDownloadModal();
            }
        };
        
        // 文档页测试函数
        function testInstallation() {
            if (typeof Atal !== 'undefined') {
                Atal.alert("ATAL安装测试成功！");
            } else {
                alert("ATAL库未正确加载，请检查路径是否正确。");
            }
        }
        
        function testBasicUsage() {
            Atal.alert("这是一个基本提示弹窗");
            
            Atal.alert({
                title: "确认操作",
                content: "您确定要执行此操作吗？",
                icon: "question",
                buttons: {
                    confirm: true,
                    cancel: true
                }
            }).ok(() => {
                Atal.alert("您点击了确认按钮");
            }).cancel(() => {
                Atal.alert("您点击了取消按钮");
            });
        }
        
        function testAdvancedConfig() {
            Atal.alert({
                title: "自定义弹窗",
                content: "这是一个自定义弹窗，5秒后自动关闭",
                icon: "success",
                buttons: {
                    confirm: {
                        text: "确定",
                        color: "#3498db"
                    },
                    cancel: {
                        text: "取消",
                        color: "#e74c3c"
                    }
                },
                animateIcon: true,
                timer: 5000
            });
        }
        
        function testTheming() {
            const myAtal = Atal.at({
                icon: "info",
                buttons: {
                    confirm: "好的",
                    cancel: false
                }
            });
            
            myAtal("预设配置", "这是一个使用预设配置的弹窗");
        }
        
        function testIcons() {
            const icons = ["success", "error", "warning", "info", "question", "heart", "star"];
            const messages = [
                "操作成功完成",
                "发生了一个错误",
                "这是一个警告",
                "这是一条信息",
                "您确定吗？",
                "您喜欢吗？",
                "给个五星好评！"
            ];
            
            let current = 0;
            
            function showNext() {
                if (current < icons.length) {
                    Atal.alert({
                        title: icons[current].charAt(0).toUpperCase() + icons[current].slice(1),
                        content: messages[current],
                        icon: icons[current],
                        buttons: {
                            confirm: current < icons.length - 1 ? "下一个" : "完成",
                            cancel: false
                        }
                    }).ok(() => {
                        current++;
                        showNext();
                    });
                }
            }
            
            showNext();
        }
    </script>
</body>
</html>